//
//  TTHomeModel.m
//  TTWeibo
//
//  Created by 陶宏路 on 16/7/25.
//  Copyright © 2016年 陶路路. All rights reserved.
//

#import "TTHomeModel.h"
#import "TTHomeViewOTO.h"
#import "TTPictureModel.h"
@implementation TTHomeModel

-(instancetype)initWithDictionary:(NSDictionary*)dic{
    
    if (self = [super init]) {
        
        [self setValuesForKeysWithDictionary:dic];
        
    }return self;
    
}

-(void)setValue:(id)value forKey:(NSString *)key{
    
    if ([key isEqualToString:@"user"]){
        
       self.user =  [[TTHomeViewOTO alloc]initWithDictionary:value];
        
    }else if ([key isEqualToString:@"retweeted_status"]){
        
        self.retweeted_status = [[TTHomeModel alloc]initWithDictionary:value];
        
    }else if ([key isEqualToString:@"pic_urls"]){
        
        NSMutableArray * tempArray = [NSMutableArray array];
        
        for (NSDictionary * dict in value) {
            
            TTPictureModel * picture = [[TTPictureModel alloc]initWithDictionary:dict];
            [tempArray addObject:picture];
        }
        
        self.pictureArray = tempArray.copy;
        
    }else{
        
        [super setValue:value forKey:key];
    }
    
}


-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
    
}

@end
